package com.heima.article.job;

import com.heima.article.service.HotArticleService;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Date;

@Component
@Slf4j
public class ArticleJob {

    @Autowired
    private HotArticleService hotArticleService;

    @XxlJob("hotArticleJob")
    public void  hotArticleJob(){
        log.info("任务执行开始"+ new Date());
        hotArticleService.hotArticle();
        log.info("任务执行结束"+ new Date());
    }
}
